// @ts-nocheck
import type { AppRouteRecordRaw } from "/@/router/types"
import { t } from "/@/hooks/web/useI18n"
import { getParentLayout, WELCOME_NAME, REDIRECT_NAME, LAYOUT, EXCEPTION_COMPONENT, PAGE_NOT_FOUND_NAME } from "/@/router/constant"
import { PageEnum } from "/@/enums/pageEnum"
import { ExceptionEnum } from "/@/enums/exceptionEnum"
const ExceptionPage = () => import("/@/views/sys/exception/Exception.vue")

// 404 on a page
export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = {
  id: PAGE_NOT_FOUND_NAME,
  path: "/:path(.*)*",
  name: 'ErrorPage',
  component: LAYOUT,
  meta: {
    title: "错误页",
    hideBreadcrumb: true,
    hideMenu: true,
  },
  children: [
    {
      id: PAGE_NOT_FOUND_NAME,
      path: "/:path(.*)*",
      name: PAGE_NOT_FOUND_NAME,
      component: EXCEPTION_COMPONENT,
      meta: {
        title: "错误页",
        hideBreadcrumb: true,
        hideMenu: true,
      },
    },
  ],
}

// // 异常路由
// export const EXCEPTION_ROUTE : AppRouteRecordRaw = {
//   path: "exception",
//   name: "systemException",
//   component: getParentLayout("ExceptionPage"),
//   redirect: "/systemException/404",
//   meta: {
//     title: t("routes.demo.page.exception"),
//   },
//   children: [
//     {
//       path: "403",
//       name: "PageNotAccess",
//       component: ExceptionPage,
//       props: {
//         status: ExceptionEnum.PAGE_NOT_ACCESS,
//       },
//       meta: {
//         title: "403",
//       },
//     },
//     {
//       path: "404",
//       name: "PageNotFoundV2",
//       component: ExceptionPage,
//       props: {
//         status: ExceptionEnum.PAGE_NOT_FOUND,
//       },
//       meta: {
//         title: "404",
//       },
//     },
//     {
//       path: "500",
//       name: "ServiceError",
//       component: ExceptionPage,
//       props: {
//         status: ExceptionEnum.ERROR,
//       },
//       meta: {
//         title: "500",
//       },
//     },
//     {
//       path: "net-work-error",
//       name: "NetWorkError",
//       component: ExceptionPage,
//       props: {
//         status: ExceptionEnum.NET_WORK_ERROR,
//       },
//       meta: {
//         title: t("routes.demo.page.netWorkError"),
//       },
//     },
//     {
//       path: "not-data",
//       name: "NotData",
//       component: ExceptionPage,
//       props: {
//         status: ExceptionEnum.PAGE_NOT_DATA,
//       },
//       meta: {
//         title: t("routes.demo.page.notData"),
//       },
//     },
//   ],
// }

export const WELCOME_ROUTE: AppRouteRecordRaw = {
  id: "Home",
  path: PageEnum.BASE_HOME,
  name: "Home",
  component: LAYOUT,
  redirect: "/home/index",
  meta: {
    title: t("routes.basic.welcome"),
  },

  children: [
    {
      id: WELCOME_NAME,
      path: "index",
      name: WELCOME_NAME,
      component: () => import("/@/views/home/index.vue"),
      meta: {
        title: t("routes.basic.welcome"),
      },
    },
  ],
}

export const REDIRECT_ROUTE: AppRouteRecordRaw = {
  id: "RedirectTo",
  path: "/redirect",
  component: LAYOUT,
  name: "RedirectTo",
  meta: {
    title: REDIRECT_NAME,
    hideBreadcrumb: true,
    hideMenu: true,
  },
  children: [
    {
      id: REDIRECT_NAME,
      path: "/redirect/:path(.*)",
      name: REDIRECT_NAME,
      component: () => import("/@/views/sys/redirect/index.vue"),
      meta: {
        title: REDIRECT_NAME,
        hideBreadcrumb: true,
      },
    },
  ],
}

export const ERROR_LOG_ROUTE: AppRouteRecordRaw = {
  id: "ErrorLog",
  path: "/error-log",
  name: "ErrorLog",
  component: LAYOUT,
  redirect: "/error-log/list",
  meta: {
    title: "ErrorLog",
    hideBreadcrumb: true,
    hideChildrenInMenu: true,
  },
  children: [
    {
      id: "ErrorLogList",
      path: "list",
      name: "ErrorLogList",
      component: () => import("/@/views/sys/error-log/index.vue"),
      meta: {
        title: t("routes.basic.errorLogList"),
        hideBreadcrumb: true,
        currentActiveMenu: "/error-log",
      },
    },
  ],
}

// 账号页面
export const ACCOUNT_PAGE: AppRouteRecordRaw = {
  id: "iam",
  path: "/iam",
  name: "iam",
  component: LAYOUT,
  redirect: "/iam/userSetting",
  meta: {
    title: "账号中心",
    // hideBreadcrumb: true,
    hideChildrenInMenu: true,
  },
  children: [
    {
      id: "account-setting",
      path: "userSetting",
      name: "account-setting",
      component: () => import("/@/views/iam/userSetting/index.vue"),
      meta: {
        title: t("routes.basic.accountSetting"),
        // hideBreadcrumb: true
        hideMenu: true,
      },
    },
  ],
}
